Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Output the pre-shared tunnel keys even when they are auto-generated #89

Merged

Conversation

cdsre
Copy link
Contributor

@cdsre cdsre commented May 22, 2023

The AWS cli nor this module require the user to provide tunnel keys for the tunnel to be created. In the event that no keys were provided AWS will automatically generate the tunnel keys. However the user will have no way to retrieve these currently in this module or via the AWS terraform provider as it doesn't expose a data resource to the tunnel options.

Currently this module will blindly return only the pre-shared keys that were provided. This PR seeks to return the pre-shared keys to the user from the aws_vpn_connection instead. This will ensure the caller gets access to the pre-shared keys even if they are auto-generated

Description

In the output.tf updated the value of the preshared key output for tunnel1 and tunnel2 to instead of returning just the var input. It will look for the pre-shared key output from each of the 4 scenarions, compact them to remove the null values and ensure only one value exists and is returned for each tunnel.

Motivation and Context

As part of terraform deployment we create the vpn connection for the project team allowing AWS to create the PSK. We planned to store the PSK in hashicorp vault at a location the projec team has access to so they could then share this with the client/customer to configure the customer gateway at their side. However we had no access to the auto-generated PSK via terraform AWS provider.

This PR would allow us to get the auto-generated PSK from the module and then use the vault provider to store that as a secret in hashicorp vault for later access.

Breaking Changes

There should be no breaking changes here. The output specification has not changed, just the internal implementation that looks for the PSK to return. Even in the use cases where the PSK was provided as VAR by the user will still work as that will be the same PSK thats in the aws_vpn_connection resource.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

I have run the complete-vpn-gateway example and validated the output matches that of the tunnel configuration in AWS

… VPN tunnel. This is useful in cases where the caller didnt specify an PSK and AWS auto-generated them. This allows the user to be able to get access to the PSK for further terraform actions, providers or secrets
@cdsre cdsre changed the title output the pre-shared tunnel keys even when they are auto-generated feat: output the pre-shared tunnel keys even when they are auto-generated May 22, 2023
@cdsre cdsre changed the title feat: output the pre-shared tunnel keys even when they are auto-generated Feat: output the pre-shared tunnel keys even when they are auto-generated May 22, 2023
@cdsre cdsre changed the title Feat: output the pre-shared tunnel keys even when they are auto-generated feat: Output the pre-shared tunnel keys even when they are auto-generated May 22, 2023
@antonbabenko antonbabenko merged commit 5ab7f2f into terraform-aws-modules:master Jun 6, 2023
antonbabenko pushed a commit that referenced this pull request Jun 6, 2023
## [3.5.0](v3.4.0...v3.5.0) (2023-06-06)

### Features

* Output the pre-shared tunnel keys even when they are auto-generated ([#89](#89)) ([5ab7f2f](5ab7f2f))
@antonbabenko
Copy link
Member

This PR is included in version 3.5.0 🎉

@github-actions
Copy link

github-actions bot commented Jul 6, 2023

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants